package org.smartboot.flow.testcase.extension;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartboot.flow.core.EngineContext;
import org.smartboot.flow.core.ExecutionListener;

/**
 * @author qinluo
 * @date 2023-06-16 19:28:24
 * @since 1.0.0
 */
public class EscapeNotifyListener implements ExecutionListener {

    private static final Logger LOGGER = LoggerFactory.getLogger(EscapeNotifyListener.class);

    @Override
    public <T, S> void completed(EngineContext<T, S> ctx) {
        if (ctx.escaped() > 100) {
            LOGGER.error("engine executed exceeded 100ms, {}, {}ms", ctx.getEngineName(), ctx.escaped());
        }
    }
}
